<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">勾选订单送SAP</li>
    </ol>
    
    <div class="ms-content-layout has-operation">
    
      <form class="form-horizontal ms-form form-personal-info" action="${ctx.host}/balances/sap-send" method="POST">
        
        <c:if test="${collectStatus eq 'C'}">
          <div class="ms-operation-bar no-margin no-bottom-border clearfix">
	          <div class="ms-operation-group pull-right">
	            <button type="submit" class="btn ms-btn ms-btn-blue">提&nbsp;&nbsp;交</button>
	          </div>
	        </div>
        </c:if>
        
        <div class="invalid-message" style="display: none;">
          <h6>提醒&nbsp;:&nbsp;请至少选择一个订单</h6>
        </div>
        
	      <table class="table table-hover ms-table">
	        <thead>
	            <tr>
	              <c:if test="${collectStatus eq 'C'}">
	                <th><input type="checkbox" id="select-all" /></th>
	              </c:if>
	              <th>订单主体公司</th>
	              <th>委托方</th>
	              <th>最终客户</th>
	              <th>调度指令号</th>
	              <th>单价</th>
	              <th>公里数</th>
	              <th>收费</th>
	              <th>出发地</th>
	              <th>目的地</th>
	              <th>车型</th>
	              <th>颜色</th>
	              <th>VIN码</th>
	              <c:if test="${collectStatus eq 'C'}">
		              <th>订单完成状态</th>
	              </c:if>
	              <th>勾送状态</th>
	            </tr>
	        </thead>
	        <tbody>
	          <c:forEach items="${saps}" var="sap">
	            
	            <tr>
	              <c:if test="${collectStatus eq 'C'}">
	                <c:choose>
		                <c:when test="${sap.orderStatus == 0}">
	    	              <td><input type="checkbox" name="shipmentFinanceId" value="${sap.shipmentFinanceId}" /></td>
		                </c:when>
		                <c:otherwise>
		                  <td><span class="glyphicon glyphicon-remove color-red"></span></td>
		                </c:otherwise>
	                </c:choose>
	              </c:if>
	              <td>${sap.organizationName}</td>
	              <td>${sap.consignorName}</td>
	              <td>${sap.clientName}</td>
	              <td>${sap.loadNumber}</td>
	              <td>${sap.feeRate}</td>
	              <td>${sap.kilometer}</td>
	              <td>${sap.fee}</td>
	              <td>${sap.srcName}</td>
	              <td>${sap.destName}</td>
	              <td>${sap.typeName}</td>
	              <td>${sap.colorName}</td>
	              <td>${sap.vincode}</td>
	              <c:if test="${collectStatus eq 'C'}">
	                <c:if test="${sap.orderStatus eq 0}"><td>已完成</td></c:if>
	                <c:if test="${sap.orderStatus eq 1}"><td>未完成</td></c:if>
	              </c:if>
	              <td>
	                <c:choose>
	                  <c:when test="${collectStatus eq 'C'}">未勾送</c:when>
	                  <c:when test="${collectStatus eq 'S'}">已勾送</c:when>
	                </c:choose>
	              </td>
	            </tr>
	          </c:forEach>
	        </tbody>
	        
	      </table>
      
      </form>
    </div> 
  </div>
         
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/business/balance/sap-list.js" />
  <script type="text/javascript">
    require(['page/business/balance/sap-list'], function(page) {
      page.init();
    })
  </script>
  
</body>
</html>